package com.dong.web.database;

import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;

public class JdbcUtils {

	public static String[] getColumns(ResultSet rs) {
		try {
			ResultSetMetaData metaData = rs.getMetaData();
			int count = metaData.getColumnCount();
			String[] columns = new String[count];
			for (int i = 0; i < count; i++) {
				columns[i] = metaData.getColumnLabel(i + 1);
			}
			return columns;
		} catch (SQLException e) {
			e.printStackTrace();
			return null;
		}
	}

}
